package ru.nsu.ccfit.kalah.activity;

import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.view.Window;
import android.widget.TextView;
import ru.nsu.ccfit.kalah.R;

public class MainMenuActivity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


        setContentView(R.layout.main_menu);
    }

    public void onClickNewGame(View v) {
        Intent intent = new Intent(this, GameSettingsActivity.class);
        startActivity(intent);
    }

    public void onClickScores(View v) {
        Intent intent = new Intent(this, ScoresActivity.class);
        startActivity(intent);

    }

    public void onClickSettings(View v) {
        Intent intent = new Intent(this, SettingsActivity.class);
        startActivity(intent);
    }

    public void onClickHelp(View v) {
        final Dialog dialog = new Dialog(this);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.dialog_about);
        final TextView textView = (TextView) dialog.findViewById(R.id.text);


        textView.setText(Html.fromHtml(getResources().getString(R.string.dialog_help_text)));

        textView.setMovementMethod(LinkMovementMethod.getInstance());
        dialog.show();
    }

    public void onClickAbout(View v) {
        final Dialog dialog = new Dialog(this);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.dialog_about);
        final TextView textView = (TextView) dialog.findViewById(R.id.text);

        String appVersion = "";
        try {
            appVersion = this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName;
        } catch (Exception e) {

        }

        textView.setText(Html.fromHtml(getResources().getString(R.string.dialog_about_text, appVersion)));

        textView.setMovementMethod(LinkMovementMethod.getInstance());
        dialog.show();
    }


}